#ifndef _IOOPERATIONIMPL_H_
#define _IOOPERATIONIMPL_H_

#include "stdafx.h"
#include <io/ioperation.h>


class CIoOperationImpl :	public	IOperation,
							public	CUnknownImp

{
public:
	CIoOperationImpl(void);
	virtual ~CIoOperationImpl(void);

	BEGIN_STDCOM_MAP
		STDCOM_INTERFACE_ENTRY(IOperation)
	END_STDCOM_MAP

	//IIoOperation
	std_method(BindIBase)(IBase* pBase);
	std_method(UnBindIBase)();
	std_method(QueryIBaseIID)(REFIID riid, void **ppv);
	std_method(BindEvent)(IBase* pEvents);
	std_method(UnBindEvent)();
	std_method(SetId)(ULONG uId);
	std_method_(ULONG, GetId)();
	std_method(SetResult)(ERROR_CODE Error, BUFFER_SIZE uTransferedBytes);
	std_method(GetResult)(ERROR_CODE *Error, BUFFER_SIZE *pTransferedBytes);
	std_method(SetIoParam)(BUFFER_SIZE uStartPos, BUFFER_SIZE uExpectBytes);
	std_method(GetIoParam)(BUFFER_SIZE* uStartPos, BUFFER_SIZE* pExpectBytes);
	std_method(SetExpect)(BUFFER_SIZE uExpectBytes);
	std_method(GetExpect)(BUFFER_SIZE *pExpectBytes);
	std_method(SetPos)(BUFFER_SIZE uPos);
	std_method(GetPos)(BUFFER_SIZE *pPos);
	std_method(SetTransfered)(BUFFER_SIZE uTransferedBytes);
	std_method(GetTransfered)(BUFFER_SIZE *pTransferedBytes);
	std_method(Attach)(BUFFER_PTR Ptr, BUFFER_SIZE Pos, BUFFER_SIZE Size);
	std_method(Alloc)(BUFFER_SIZE Size);
	std_method(GetLen)(BUFFER_SIZE *Len);
	std_method(GetPtr)(BUFFER_PTR* Ptr);
	std_method(ReleasePtr)();
	std_method(ClearPtr)();
	std_method(Post)(ULONG event, ULONG error_code);
private:
	ERROR_CODE						m_Errorcode;
	BUFFER_SIZE						m_pTransferedBytes;
	BUFFER_SIZE						m_id;
	BUFFER_SIZE						m_uStartPos;
	BUFFER_SIZE						m_uExpectBytes;
	BUFFER_SIZE						m_pBufLen;
	UCharArrayPtr					m_pBuf;
	OperationEventPtr				m_pEvent;
	BasePtr							m_pBase;
};
#endif

